/*代理模式*/

#include <iostream>
using namespace std;

//房子处理方式 抽象类
class RentHouse
{
public:
    //房子处理
    virtual void rentHouse() = 0;
};

//房东类 只负责将房子卖出去
class Landlord : public RentHouse
{
public:
    void rentHouse() override
    {
        cout<<"Landlord:卖房"<<endl;
    }
};

//中介类 负责房子的销售和打理
class Intermediary : public RentHouse
{
public:
    void rentHouse() override
    {
        cout<<"Intermediary:发布卖房信息"<<endl;
        cout<<"Intermediary:带人看房"<<endl;
        _landlord.rentHouse(); //通知房主卖房
        cout<<"Intermediary:负责售后"<<endl;
    }
private:
    Landlord _landlord;
};

int main()
{
    //购房者联系中介
    Intermediary intermediary;
    intermediary.rentHouse();
    
    //Intermediary().rentHouse();
    return 0;
}